﻿@using HouseHoldBudget.Framework.Mvc.Helpers
@using HouseHoldBudget.Models.Common
@using Kendo.Mvc.UI
@model MenuModel

@if (Model != null && Model.AdminMenus != null)
{
    @(Html.Kendo().Menu()
               .Name("PanelBar")
               .BindTo(Model.AdminMenus, mappings =>
                                         mappings.For<HomeMenuItem>(binding => binding
                                                                                   .ItemDataBound((item, category) =>
                                                                                                      {
                                                                                                          item.ImageUrl = Url.Image(category.IconUri);
                                                                                                          item.Text = category.Name;
                                                                                                          item.ActionName = category.ActionName;
                                                                                                          item.ControllerName = category.ControllerName;
                                                                                                          item.Enabled = category.IsAuthorized;
                                                                                                      })
                                                                                   .Children(category => category.SubMenus)))
                                                                                   )
}